package com.test.service.impl;

import com.test.dao.UserMapper;
import com.test.entity.UserTb;
import com.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;

    /*
     * 检验用户登录业务
     *
     */

    public UserTb checkLogin(String username, String password) {

        UserTb user = userMapper.findByUsername(username);
        if(user != null && user.getUserPwd().equals(password)){

            return user;
        }
        return null;
    }

    @Override
    public void Regist(UserTb user) {
        userMapper.registerByUsernameAndPassword(user.getUserName(),user.getUserPwd());
    }

}
